#由dgl自带的图数据库绘图
from dgl.data import MiniGCDataset
import matplotlib.pyplot as plt
import networkx as nx
# 数据集包含了80张图。每张图有10-20个节点(num_graphs, min_num_v, max_num_v, seed)
dataset = MiniGCDataset(80, 10, 20)
graph, label = dataset[0]
fig, ax = plt.subplots()
#Graph(num_nodes=15, num_edges=45,      ndata_schemes={}      edata_schemes={})
nx.draw(graph.to_networkx(), ax=ax)
ax.set_title('Class: {:d}'.format(label))
# plt.show()
plt.savefig("graph.png")
# print(graph)